package ee.az.test.lighting;


/**
 * @author Artur Zinatullin (artur.zinatullin@gmail.com) 2010
 */
public class IconMap<S extends IconSpot> extends AbstractMap<S> {
	
	public IconMap(int width, int height) {
		super(width, height);
	}
	
	@Override
	@SuppressWarnings("unchecked")
	protected S createDefaultSpot() {
		return (S) new IconSpotImpl('.');
	}
	
	public void drawLine(int x1, int y1, int x2, int y2, char icon) {
		Line line = getLine(x1, y1, x2, y2);
		drawLine(line, icon);
	}

	public void drawLine(Line line, char icon) {
		for (int i=0; i < line.getLength(); i++) {
			int x = line.getPoints()[i].getX();
			int y = line.getPoints()[i].getY();
			((IconSpot)getValue(x, y)).setIcon(icon);
		}
	}
}
